#define  _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>

typedef int KeyType;
typedef struct
{
	KeyType key;
}ElmeType;
typedef struct Node
{
	ElmeType data;
	struct Node* left;
	struct Node* right;
}BSTreeBode,*BSTree;

int SearchBST(KeyType k, BSTree& T, BSTree& f, BSTree& p)
{
	if (T == NULL)
	{
		p = f;
		return 0;
	}
	else if (k == T->data.key)
	{
		p = f;
		return 1;
	}
	else if (k < T->data.key)
		return SearchBST(k, T->left, T, p);
	else
		return SearchBST(k, T->right, T, p);
}